package com.vincent.task;

import com.vincent.dao.AdDao;
import com.vincent.dao.ArticleDao;
import com.vincent.dao.HotSearchDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * Created by Vincent on 2014/12/28.
 */
@Component("clearCacheTask")
public class ClearCacheTask {

    private static final Logger log=Logger.getLogger(ClearCacheTask.class);

    @Resource
    private HotSearchDao hotSearchDao;
    @Resource
    private ArticleDao articleDao;
    @Resource
    private AdDao adDao;

    /**
     * 半夜0点清除缓存
     */
    public void runZero() {
        hotSearchDao.clearCache();
        articleDao.clearCache();
        adDao.clearCache();
        log.info("零点缓存清除成功");
    }

}
